package com.googlecode.messwertepi.module;

import com.googlecode.messwertepi.model.DataModel;

import javax.inject.Provider;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;

/**
 * This provider creates a bunch of dummy data.
 *
 * Created by eike on 26.06.14.
 */
public class DummyDataModelProvider implements Provider<DataModel> {

    @Override
    public DataModel get() {
        List<String> data = new ArrayList<>();
        for (int i = 1; i <= 64; i++) {
            data.add(getRandomString(32));
        }

        return new DataModel("", data);
    }

    private String getRandomString(int length)
    {
        String result = "";
        Random rand = new Random();
        for (int i = 0; i < length; i++) {
            result += (char)(rand.nextInt(26) + 'a');
        }

        return result;
    }
}
